package main

import (
	"fmt"
	"sync"
	"time"
)

var wg sync.WaitGroup

func fn1() {
	for i := 0; i < 10; i++ {
		fmt.Println(i)
		time.Sleep(time.Millisecond * 100)
	}
}

func fn2() {
	defer func() {
		if err := recover(); err != nil {
			fmt.Println("fn2 发生错误")
		}
	}()
	var m map[int]string
	//m = make(map[int]string)
	//m = map[int]string{}
	m[0] = "aaaaa"
}

func main() {
	go fn1()
	go fn2()

	time.Sleep(time.Second)
}
